#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;
#define MAX_SIZE 100
typedef char ElementType;
typedef struct BinaryNode {
	struct BinaryNode* pLeftChild;
	struct BinaryNode* pRightChild;
	ElementType value;
}BiNode, *BiTree;
void createTree(BiTree* biTree) {
	ElementType input;
	scanf("%c", &input);
	if (input == ' ') {
		*biTree = nullptr;
	}
	else {
		(*biTree) = new BiNode;
		(*biTree)->value = input;
		createTree(&(*biTree)->pLeftChild);
		createTree(&(*biTree)->pRightChild);
	}
}
void prlongTreeNode(BiTree pBiTree) {
	printf("%c\n",pBiTree->value);
}
void treeTraversal(BiTree pBiTree) {
	if (pBiTree) {
		treeTraversal(pBiTree->pLeftChild);
		
		//treeTraversal(pBiTree->pLeftChild);
		treeTraversal(pBiTree->pRightChild);
		prlongTreeNode(pBiTree);
	}
}
int main() {
	BiTree biTree;
	createTree(&biTree);
	treeTraversal(biTree);
	return 0;
}